home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / creat.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  2.1 KB  |  67 lines

  1.  
  2.  
  3.  
  4. CREAT(3)            MINTLIB LIBRARY FUNCTIONS            CREAT(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        creat - create a new file
  9.  
  10. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  11.        #include <unistd.h>
  12.  
  13.        int creat(const char *path, unsigned int mode);
  14.  
  15. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  16.        This interface is made obsolete by open, since,
  17.  
  18.          creat(path, mode);
  19.  
  20.        is equivalent to
  21.  
  22.          open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
  23.  
  24.        which actually is the way creat is implemented.
  25.  
  26.        creat  creates  a new ordinary file or prepares to rewrite
  27.        an existing file named by the pathname pointed to by path.
  28.        If the file did not exist, it is given the mode 'mode', as
  29.        modified by the process's mode mask (see umask). See  stat
  30.        for the construction of mode.
  31.  
  32.        If  the  file exists, its mode and owner remain unchanged,
  33.        but it is truncated to 0  length.  Otherwise,  the  file's
  34.        owner  ID  is set to the effective user ID of the process,
  35.        and upon successful completion, creat marks for update the
  36.        st_atime,  st_ctime,  and st_mtime fields of the file (see
  37.        stat) and the st_ctime and st_mtime fields of  the  parent
  38.        directory.
  39.  
  40.        Upon   successful   completion,  the  file  descriptor  is
  41.        returned and the file is open for  writing,  even  if  the
  42.        access  permis- sions of the file mode do not permit writ-
  43.        ing. The file pointer is set to the beginning of the file.
  44.        The  file  descriptor  is set to remain open across execve
  45.        system calls. See fcntl.
  46.  
  47. R✓RE✓ET✓TU✓UR✓RN✓N V✓VA✓AL✓LU✓UE✓ES✓S
  48.        creat returns a non-negative descriptor that only  permits
  49.        writing  on  success.  On  failure, it returns -1 and sets
  50.        errno to indicate the error.
  51.  
  52. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  53.        c✓cl✓lo✓os✓se✓e(✓(3✓3)✓),✓,   c✓ch✓hm✓mo✓od✓d(✓(3✓3)✓),✓,   e✓ex✓xe✓ec✓cv✓ve✓e(✓(3✓3)✓),✓,   f✓fc✓cn✓nt✓tl✓l(✓(3✓3)✓),✓,   f✓fl✓lo✓oc✓ck✓k(✓(3✓3)✓),✓,
  54.        o✓op✓pe✓en✓n(✓(3✓3)✓),✓, w✓wr✓ri✓it✓te✓e(✓(3✓3)✓),✓, u✓um✓ma✓as✓sk✓k(✓(3✓3)✓)
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.